home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
BHole.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
926b
|
55 lines
#include "stdafx.h"
cBlackHole::cBlackHole(int _x, int _y, cProperties *_orig)
: cWeapon(_x, _y, _orig, "MOVING")
{
active = FALSE;
}
cBlackHole::~cBlackHole()
{
}
void cBlackHole::attract_all(cGameObject *l)
{
for (; l != 0; l = (cGameObject *)l->next)
if (l != this && l->influenced_by_black_hole)
l->new_angular_push(0.2, 0, BLACK_HOLE_STRENGTH, angle(x - l->x, y - l->y));
}
int cBlackHole::control()
{
cWeapon::control();
bounce_on_boundaries();
// Check if we were hit
if (explode)
{
// If we were not active before, set animation
if (!active)
{
set_sequence("ACTIVE", TRUE);
active = TRUE;
}
// Push things around every fifth second
if (!push_wait)
{
attract_all(weapons);
attract_all(bonus);
attract_all(parts);
push_wait = sec / 5;
}
}
// Delete when off screen
return !in_water();
}